package com.wondertek.poms.job.handler;

import com.wondertek.poms.common.vo.ResultBean;
import com.wondertek.poms.job.client.PlanMoveClient;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author evan0213
 * @description
 */
@JobHandler(value = "planMoveJobHandler")
@Component
@Slf4j
public class PlanMoveJobHandler extends IJobHandler {
	@Autowired
	private PlanMoveClient planMoveClient;

	@Override
	public ReturnT<String> execute(String s) {
		XxlJobLogger.log("计划移包定时任务启动");
		log.info("**********计划移包定时任务启动************");
		//计划移包
		ResultBean resultBean = planMoveClient.planMove();
		String code = resultBean.getCode();
		XxlJobLogger.log("计划移包定时任务结束");
		if ("0".equals(code)) {
			return SUCCESS;
		} else {
			return FAIL;
		}
	}
}
